<template>
<!-- 头部部分 -->
    <header class="header">
      <h1>todos</h1>
      <input v-model.trim="hAdd"
      @keydown.enter="taskname"
       class="new-todo" placeholder="请输入任务名称" autofocus />
    </header>
</template>

<script>
export default {
  name: 'VueXuxiTodoHeader',

  data() {
    return {
      hAdd:''
    };
  },

  mounted() {
    
  },

  methods: {
    taskname(){
      if(this.hAdd === '')return
      this.$emit('taskname',this.hAdd)
      this.hAdd = ''
    },
  },
};
</script>

<style lang="scss" scoped>

</style>